import { AbstractReactFactory } from '@projectstorm/react-canvas-core';
import { DiagramEngine } from '@projectstorm/react-diagrams-core';
import { DatabaseNodeModel } from './DatabaseNodeModel';
import { DatabaseNodeWidget } from './DatabaseNodeWidget';
import { DATABASE_NODE_MODEL_TYPE } from './constants';

export class DatabaseNodeFactory extends AbstractReactFactory<DatabaseNodeModel, DiagramEngine> {
	constructor() {
		super(DATABASE_NODE_MODEL_TYPE);
	}

	// @ts-ignore
	generateReactWidget(event): JSX.Element {
		return <DatabaseNodeWidget engine={this.engine} node={event.model} />;
	}

	// @ts-ignore
	generateModel(event) {
		return new DatabaseNodeModel();
	}
}